
package main

import (
	"github.com/go-redis/redis"
	"fmt"
	"github.com/sniperHW/kendynet/asyn"
    "github.com/sniperHW/kendynet/event"  
)





func main() {
	client := redis.NewClient(&redis.Options{
		Addr:     "192.168.146.128:6379",
		Password: "", // no password set
		DB:       0,  // use default DB
	})

	pong, err := client.Ping().Result()
	fmt.Println(pong, err)


    queue := event.NewEventQueue()


    ping := asyn.AsynWrap(queue,client.Ping().Result)

    ping(func(ret []interface{}){
    	fmt.Println(ret)
    })


	cmd := client.HScan("game",0,"",2)
	it := cmd.Iterator()
	for it.Next() {
		fmt.Println("key",it.Val())
		if !it.Next() {
			break
		}
		fmt.Println("value",it.Val())
	}
    queue.Run()
}
